#include <iostream>
#include <vector>

using namespace std;

int n;
int tree[1000010][2];
int sta[1000010], staLen = 0;

int pushVal(int x) {
    sta[staLen++] = x;
}
int getTop() {
    return sta[staLen - 1];
}
int popSta() {
    staLen--;
}

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> tree[i][0] >> tree[i][1];
    while (true) {
        int node=sta]
    }
}